package com.sky.context;

public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    public static ThreadLocal<String> threadLocalName = new ThreadLocal<>();
    public static ThreadLocal<Long> threadLocalUserId = new ThreadLocal<>();
    public static ThreadLocal<String> threadLocalUsername = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }


    public static Long getCurrentUserId() {
        return threadLocalUserId.get();
    }

    public static void setCurrentUserId(Long id) {
        threadLocalUserId.set(id);
    }


    public static Long getCurrentId() {
        return threadLocal.get();
    }

    public static void removeCurrentId() {
        threadLocal.remove();
    }


    public static void setCurrentUserName(String userName) {
        threadLocalUsername.set(userName);
    }


    public static String getCurrentName() {
        return threadLocalName.get();
    }

    public static void setCurrentName(String name) {
        threadLocalName.set(name);
    }


    public static String getCurrentUserName() {
        return threadLocalUsername.get();
    }

    public static void removeCurrentUserName() {
        threadLocalUsername.remove();
    }
}
